<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>1.何为数据劫持</title>
  </head>
  <body>
    <button id="btn">把a变成999</button>

    <script type="text/javascript" >
        let obj = {}

        Object.defineProperty(obj,'a',{
          get (){
            return 1
          },
          set (value){
            console.log('a被修改了，我要寻找页面中使用a的地方，去更新',value)
          }
        })


        btn.addEventListener('click',()=>{
          obj.a = 999
        })

    </script>
  </body>
</html>